#!/usr/bin/env python
# -*- coding:utf-8 -*-

# file:do_udp_ceive.py
# author:Jackiex
# datetime:2023/5/29 11:25
# software: PyCharm

"""
this is function  description 
"""

from socket import *


def main():
    # 绑定端口信息
    udp_socket = socket(AF_INET, SOCK_DGRAM)

    local_addr = ('', 6789)
    local_addr = ('127.0.0.1', 6666)
    udp_socket.bind(local_addr)
    # 接收数据
    recv_data = udp_socket.recvfrom(1024)  # 1024表示本次接收的最大字节数
    # 打印显示接收到的数据
    print(recv_data)

    # 迭代升级
    # print("%s:%s" %(recv_data[0].decode('gbk'),recv_data[1]))

    # 关闭套接字
    udp_socket.close()


if __name__ == "__main__":
    main()